//导入request.js请求工具
import request from '@/utils/request.js'

//提供调用登录接口的函数
export const loginService = (loginData)=>{
    const params = new URLSearchParams();
    for(let key in loginData){
        params.append(key,loginData[key])
    }
    return request.post('/admin/login',params)

}

//注册
export const registerService = (registerData)=>{
    const params = new URLSearchParams();
    for(let key in registerData){
        params.append(key,registerData[key])
    }
    return request.post('/admin/register',params)
}

//获取用户详细信息
export const adminInfoService = ()=>{
    return request.get('/admin/adminInfo')
}

//修改个人信息
export const adminInfoUpdateService = (userInfoData)=>{
    return request.put('/admin/updateInfo',userInfoData)
}

//修改密码
export const adminUpdatePwd = (pwdData)=>{
    return request.patch('/admin/updatePwd',pwdData)
}

//查询读者
export const readerListService = (params)=>{
    return request.get('/admin/reader',{params:params})
}

//添加读者
export const addReaderService = (readerData)=>{
    return request.post('/admin/addReader',readerData)
}

//修改读者
export const updateReaderService = (readerData)=>{
    return request.put('/admin/updateReader',readerData)
}
